cksum: rework blake length validation , add tests#11437
Merged
cakebaker merged 5 commits intouutils:mainfrom Mar 25, 2026
Merged
cksum: rework blake length validation , add tests#11437cakebaker merged 5 commits intouutils:mainfrom
cakebaker merged 5 commits intouutils:mainfrom
Conversation
Merging this PR will not alter performance
Comparing Footnotes
|
6f514f8 to
b0547e7
Compare
Contributor
|
I don't know if you have seen it: clippy complains about two minor issues. |
6f2a9eb to
a6f6cf7
Compare
Collaborator
Author
Yes, I just fixed it ^^ |
|
GNU testsuite comparison: |
cakebaker
reviewed
Mar 23, 2026
cakebaker
reviewed
Mar 23, 2026
cakebaker
reviewed
Mar 23, 2026
a6f6cf7 to
98f6c4f
Compare
|
GNU testsuite comparison: |
…algo... ...on applicable tests
98f6c4f to
c85b3b4
Compare
|
GNU testsuite comparison: |
Contributor
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes a tricky edge case that happened when validating a length for the Blake2b algorithm in check mode, which didn't check early for the maximum allowed value, and ended up showing an unexpected error message.
To do so, I centralized all the Blake length validation logic under
validate_calculate_blake_length. This function may be given a string or an int to work on, depending whether we're validating from CLI argument or check-file.Note that it is important to preserve the string format in CLI argument, because for GNU compat, in case of error, we print the given argument, not the number we parsed from it (so that includes leading zeroes).
This MR additionnally adds more tests for BLAKE3 and some edge case tests for BLAKE2b.